import {createStore}  from 'vuex'
interface  State{
    userName: String
    taskList: any[]
}

export default createStore({
    state: {

        userName: 'Simon Xu',
        taskList: []
    },
    mutations: {
        createTask(state:any,newTask:string){
            state.taskList.push(newTask)
        },
        deleteTask(state:any,index:number){
            state.taskList.splice(index,1)
        },
        updateTask(state:any,payload: any) {
        
            const {index, status } = payload
            state.taskList[index].isFinished = status
        }

    }
});